import http from '@/utils/request'

const apiBefore = '/web/um'

export const system = {
  /**
   * sys -----------------------------------------------------------------------------------------------------------------------------------
   */
  generalListApi: () => {
    return http.get(`${apiBefore}/sys/dict/type/all`)
  },
  getAssert: (params) => {
    return http.get(`${apiBefore}/sys/menu/nav/assert`, { params })
  },
  navMenuListApi: params => {
    return http.get(`${apiBefore}/sys/menu/nav`, { params })
  },
  navMenuListApiPrimary: params => {
    return http.get(`${apiBefore}/sys/menu/nav/primary`, { params })
  },
  getUserInfoApi: params => {
    return http.get(`${apiBefore}/sys/user/info`, { params })
  },
  postCheckRoleApi: params => {
    return http.post(`${apiBefore}/sys/user/checkRole`, params)
  },
  getUserPermissionsApi: (params) => {
    return http.get(`${apiBefore}/sys/menu/permissions`, { params })
  },
  getUnreadMessageApi: () => {
    return http.get(`${apiBefore}/sys/notice/mynotice/unread`)
  },
  getSystemInfoApi: () => {
    return http.get(`${apiBefore}/sys/info`)
  },
  getDeptListApi: () => {
    return http.get(`${apiBefore}/sys/dept/list`)
  },
  getRegionTreeApi: () => {
    return http.get(`${apiBefore}/sys/region/tree`)
  },
  putUserPasswordApi: params => {
    return http.put(`${apiBefore}/sys/user/password`, params)
  },
  getMailtemplateInfoApi: id => {
    return http.get(`${apiBefore}/sys/mailtemplate/${id}`)
  },
  getMailtemplateConfigApi: () => {
    return http.get(`${apiBefore}/sys/mailtemplate/config`)
  },
  mailtemplateSaveConfigApi: params => {
    return http.post(`${apiBefore}/sys/mailtemplate/saveConfig`, params)
  },
  mailtemplateSendApi: params => {
    return http.post(`${apiBefore}/sys/mailtemplate/send`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  getSmsInfoApi: id => {
    return http.get(`${apiBefore}/sys/sms/${id}`)
  },
  smsSendApi: params => {
    return http.post(`${apiBefore}/sys/sms/send`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  getNoticeInfoApi: id => {
    return http.get(`${apiBefore}/sys/notice/${id}`)
  },
  getOssInfoApi: () => {
    return http.get(`${apiBefore}/sys/oss/info`)
  },
  ossApi: params => {
    return http.post(`${apiBefore}/sys/oss`, params)
  },
  getDeptInfoApi: id => {
    return http.get(`${apiBefore}/sys/dept/${id}`)
  },
  getDictDataApi: id => {
    return http.get(`${apiBefore}/sys/dict/data/${id}`)
  },
  getDictTypeApi: id => {
    return http.get(`${apiBefore}/sys/dict/type/${id}`)
  },
  getMenuListApi: () => {
    return http.get(`${apiBefore}/sys/menu/list?type=0`)
  },
  getMenuListWithLazyApi: pid => {
    return http.get(`${apiBefore}/sys/menu/selectByPid/${pid}`)
  },
  getMenuInfoApi: id => {
    return http.get(`${apiBefore}/sys/menu/${id}`)
  },
  getSystemParamsInfoApi: id => {
    return http.get(`${apiBefore}/sys/params/${id}`)
  },
  getRegionInfoApi: id => {
    return http.get(`${apiBefore}/sys/region/${id}`)
  },
  getRegionListApi: id => {
    return http.get(`${apiBefore}/sys/region/list?pid=${id}`)
  },
  getMenuSelectApi: () => {
    return http.get(`${apiBefore}/sys/menu/select`)
  },
  getRoleInfoApi: id => {
    return http.get(`${apiBefore}/sys/role/${id}`)
  },
  getRoleListApi: () => {
    return http.get(`${apiBefore}/sys/role/list`)
  },
  getDefaultRoleListApi: () => {
    return http.get(`${apiBefore}/sys/role/client/default-role-list`)
  },
  getClientRoleListApi: params => {
    return http.get(`${apiBefore}/sys/role/client/client-role-list`, { params })
  },
  saveClientRoleListApi: params => {
    return http.post(`${apiBefore}/sys/role/client/save`, params)
  },
  deleteClientRoleListApi: id => {
    return http.delete(`${apiBefore}/sys/role/client/delete/${id}`)
  },
  deleteClientOrDefaultRoleListApi: params => {
    return http.delete(`${apiBefore}/sys/role/client/delete`, params)
  },
  getUserInfoWithIdApi: id => {
    return http.get(`${apiBefore}/sys/user/${id}`)
  },
  getUserAddHomeChannelApi: id => {
    return http.get(`${apiBefore}/teams/channel/list-tenant`)
  },
  getUserManagerListApi: params => {
    return http.get(`${apiBefore}/sys/user/manager/select`, { params: params })
  },
  getUserManagerPage: params => {
    return http.get(`${apiBefore}/sys/user/page-obj`, { params })
  },
  deleteUserInfoApi: params => {
    return http.delete(`${apiBefore}/sys/user`, params)
  },
  getTenantRoleListApi: () => {
    return http.get(`${apiBefore}/sys/tenant/role/list`)
  },
 
  getTenantRoleInfoApi: id => {
    return http.get(`${apiBefore}/sys/tenant/role/${id}`)
  },
  updateReadStatusApi: id => {
    return http.put(`${apiBefore}/sys/notice/mynotice/read/${id}`)
  },
  postTenantRole: params => {
    return http.post(`${apiBefore}/sys/tenant/role`, params)
  },
  putTenantRole: params => {
    return http.put(`${apiBefore}/sys/tenant/role`, params)
  },
  postRole: params => {
    return http.post(`${apiBefore}/sys/role`, params)
  },
  putRole: params => {
    return http.put(`${apiBefore}/sys/role`, params)
  },
  postregion: params => {
    return http.post(`${apiBefore}/sys/region`, params)
  },
  postUploadImg: params => {
    return http.post(`${apiBefore}/sys/oss/upload-path-base64`, params)
  },
  putregion: params => {
    return http.put(`${apiBefore}/sys/region`, params)
  },
  postSysParams: params => {
    return http.post(`${apiBefore}/sys/params`, params)
  },
  putSysParams: params => {
    return http.put(`${apiBefore}/sys/params`, params)
  },
  getSystemParamsPage: params => {
    return http.get(`${apiBefore}/sys/params/page`, { params })
  },
  getRoleAssets: params => {
    return http.get(`${apiBefore}/sys/tenant/role/assets`, { params })
  },
  postSysMenu: params => {
    return http.post(`${apiBefore}/sys/menu`, params)
  },
  putSysMenu: params => {
    return http.put(`${apiBefore}/sys/menu`, params)
  },
  postSysDictType: params => {
    return http.post(`${apiBefore}/sys/dict/type`, params)
  },
  putSysDictType: params => {
    return http.put(`${apiBefore}/sys/dict/type`, params)
  },
  postSysDictData: params => {
    return http.post(`${apiBefore}/sys/dict/data`, params)
  },
  putSysDictData: params => {
    return http.put(`${apiBefore}/sys/dict/data`, params)
  },
  postSysDept: params => {
    return http.post(`${apiBefore}/sys/dept`, params)
  },
  putSysDept: params => {
    return http.put(`${apiBefore}/sys/dept`, params)
  },
  postSysNotice: params => {
    return http.post(`${apiBefore}/sys/notice/`, params)
  },
  putSysNotice: params => {
    return http.put(`${apiBefore}/sys/notice/`, params)
  },
  postSysSms: params => {
    return http.post(`${apiBefore}/sys/sms`, params)
  },
  putSysSms: params => {
    return http.put(`${apiBefore}/sys/sms`, params)
  },
  postSysMailTemplate: params => {
    return http.post(`${apiBefore}/sys/mailtemplate`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  putSysMailTemplate: params => {
    return http.put(`${apiBefore}/sys/mailtemplate`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  postSysUser: params => {
    return http.post(`${apiBefore}/sys/user`, params)
  },
  putSysUser: params => {
    return http.put(`${apiBefore}/sys/user`, params)
  },
  postSettingUserApi: params => {
    return http.post(`${apiBefore}/sys/user-setting`, params)
  },
  postSettingUserArrApi: params => {
    return http.post(`${apiBefore}/sys/user-setting/save-update-batch`, params)
  },
  postSysTenant: params => {
    return http.post(`${apiBefore}/sys/tenant`, params)
  },
  putSysTenant: params => {
    return http.put(`${apiBefore}/sys/tenant`, params)
  },
  // this.$interface.system.updateReadStatusApi()
  /**
   * logout
   */
  userLogoutApi: () => {
    return http.post(`${apiBefore}/logout`)
  },
  // update redis Info
  updateRedisInfoApi: params => {
    return http.get(`${apiBefore}/sys/tenant/initRedis`, { params })
  },
  // delte redis Info
  delUserRedisInfoApi: params => {
    return http.get(`${apiBefore}/sys/user/initRedis`, { params })
  },
  /**
   * demo
   */
  getDemoNewsInfoApi: id => {
    return http.get(`${apiBefore}/demo/news/${id}`)
  },
  postDemoNew: params => {
    return http.post(`${apiBefore}/demo/news`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  putDemoNew: params => {
    return http.put(`${apiBefore}/demo/news`, params, { headers: { 'content-type': 'application/x-www-form-urlencoded' } })
  },
  /**
   * act -----------------------------------------------------------------------------------------------------------------------------------
   */
  completeTaskApi: params => {
    return http.post(`${apiBefore}/act/task/complete?${params}`)
  },
  getProcessLastestPageApi: params => {
    return http.get(`${apiBefore}/act/process/lastestPage`, { params })
  },
  getProcDefBizRouteApi: id => {
    return http.post(`${apiBefore}/act/process/getProcDefBizRoute/${id}`)
  },
  getProcDefBizRouteAndProcessInstanceApi: params => {
    return http.get(`${apiBefore}/act/process/getProcDefBizRouteAndProcessInstance`, { params })
  },
  getLatestProcDefBizRouteApi: params => {
    return http.get(`${apiBefore}/act/process/getLatestProcDefBizRoute`, { params })
  },
  modelDeployApi: id => {
    return http.post(`${apiBefore}/act/model/deploy/${id}`)
  },
  taskClaimApi: params => {
    return http.post(`${apiBefore}/act/task/claim`, params)
  },
  runningStartApi: params => {
    return http.post(`${apiBefore}/act/running/start`, params)
  },
  putProcessActiveApi: id => {
    return http.put(`${apiBefore}/act/process/active/${id}`)
  },
  putProcessSuspendApi: id => {
    return http.put(`${apiBefore}/act/process/suspend/${id}`)
  },
  convertToModelApi: id => {
    return http.put(`${apiBefore}/act/process/convertToModel/${id}`)
  },
  demoCorrectionApi: id => {
    return http.get(`${apiBefore}/act/demo/correction/${id}`)
  },
  backPreviousTaskApi: params => {
    return http.post(`${apiBefore}/act/task/backPreviousTask?`, params)
  },
  taskEntrustApi: params => {
    return http.post(`${apiBefore}/act/task/entrust`, params)
  },
  taskBackToFirstApi: params => {
    return http.post(`${apiBefore}/act/task/backToFirst?`, params)
  },
  taskEndProcessApi: params => {
    return http.post(`${apiBefore}/act/task/endProcess`, params)
  },
  runningStartOfBusinessKeyApi: params => {
    return http.post(`${apiBefore}/act/running/startOfBusinessKey`, params)
  },
  postModelInfoApi: params => {
    return http.post(`${apiBefore}/act/model`, params)
  },
  putModelInfoApi: params => {
    return http.put(`${apiBefore}/act/model`, params)
  },
  // this.$interface.system.postModelInfoApi()
  postSaveProcBizRoute: params => {
    return http.post(`${apiBefore}/act/process/saveProcBizRoute`, params)
  },
  putSaveProcBizRoute: params => {
    return http.put(`${apiBefore}/act/process/saveProcBizRoute`, params)
  },
  getClientList: params => {
    return http.get(`${apiBefore}/sys/tenant/list`, { params })
  },


  // dashboard
  saveDashboardLayout: params => {
    return http.post(`${apiBefore}/sys/dashboard/save`, params)
  },
  // getDashboardLayout: params => {
  //   return http.get(`${apiBefore}/sys/dashboard/business-id/${params.businessId}`, { params })
  // },

  // tenant list
  getTenantListApi: params => {
    return http.get(`${apiBefore}/sys/tenant/page`, { params })
  },
  // check user name
  checkUserNameApi: params => {
    return http.post(`${apiBefore}/sys/user/checkName`, params)
  },
  refreshCacheALLApi: params => {
    return http.get(`${apiBefore}/sys/dict/type/refreshCache`, { params })
  },
  // reset password
  resetClinentPortalPassword: params => {
    return http.post(`${apiBefore}/sys/user/resetPassword`, params)
  },
  getLogOperationListApi: params => {
    return http.get(`${apiBefore}/sys/log/operation/page`, { params })
  },
  updateRoleForIdApi: params => {
    return http.post(`${apiBefore}/sys/user/updateRole`, params)
  },
  clientPortalByUsername: params => {
    return http.get(`${apiBefore}/sys/user/clientPortalByUsername`, { params })
  },

  exportData: params => {
    return http.get(`/web/um/data/setting/export`)
  },
  rollBackList: params => {
    return http.get(`/web/um/data/setting/backupDataList`)
  },
  rollback: params => {
    return http.post(`/web/um/data/setting/rollBackData`, params)
  },
  getUserListByDashboard: params => {
    return http.get(`${apiBefore}/sys/user/listByDashboard`, { params })
  },
  clientLogApi: (params) => {
    return http.post(`/web/reports/visit/time`,params)
  },

  // peer group
  createPeerGroup: params => {
    return http.post(`${apiBefore}/peer/group/build`, params)
  },
  deletePeerGroup: params => {
    return http.delete(`${apiBefore}/peer/group/del/${params.groupId}`, params)
  },
  updatePeerGroup: params => {
    return http.put(`${apiBefore}/peer/group/update`, params)
  },
  getPeerGroupList: params => {
    return http.post(`${apiBefore}/peer/group/list`, params)
  },
  getPeerGroupDetail: params => {
    return http.get(`${apiBefore}/peer/group/detail/${params.groupId}`, { params })
  },
  checkGroupCaptain: params => {
    return http.get(`${apiBefore}/peer/user/check/${params.groupId}/${params.userId}`, params)
  },
  creatorPeerGroupUser: params => {
    return http.get(`${apiBefore}/peer/group/creator`, { params })
  },
  invitePeerGroupUser: params => {
    return http.post(`${apiBefore}/peer/user/invite`, params)
  },
  acceptPeerGroupUser: params => {
    return http.post(`${apiBefore}/peer/user/accept`, params)
  },
  userRolePeerGroup: params => {
    return http.get(`${apiBefore}/peer/user/role/${params.groupId}/${params.userId}/${params.type}`, params)
  },
  deletePeerGroupUser: params => {
    return http.delete(`${apiBefore}/peer/user/del/${params.groupId}/${params.userId}`, params)
  },
  getPeerGroupUser: params => {
    return http.get(`${apiBefore}/peer/user/list/${params.groupId}`, { params })
  },
  applyPeerGroup: params => {
    return http.post(`${apiBefore}/peer/apply/add`, params)
  },
  deleteApplyPeerGroup: params => {
    return http.delete(`${apiBefore}/peer/apply/del/${params.groupId}`, params)
  },
  updateApplyPeerGroup: params => {
    return http.put(`${apiBefore}/peer/apply/update`, params)
  },
  applyPeerGroupList: params => {
    return http.get(`${apiBefore}/peer/apply/list`, { params })
  },
  approvalPeerGroup: params => {
    return http.get(`${apiBefore}/peer/apply/${params.approval}/${params.userId}/${params.groupId}`, params)
  },
  benchmarkList: params => {
    return http.get(`${apiBefore}/peer/benchmark/${params.groupId}/list`)
  },
  benchmarkAdd: params => {
    return http.post(`${apiBefore}/peer/benchmark/${params.groupId}/add`, params.list)
  },
  benchmarkDelete: params => {
    return http.delete(`${apiBefore}/peer/benchmark/${params.id}/del`)
  },
  updateSettingSystemMail: params => {
    return http.post(`${apiBefore}/sys/software/setting/save`,params)
  },
  testConnectionSystemMail: (params) => {
    return http.post(`/web/notice/email-process/check`,params)
  },
  getAttendanceOrder: params => {
    return http.get(`${apiBefore}/sys/user-setting`,{params})
  },
  setAttendanceOrder: params => {
    return http.post(`${apiBefore}/sys/user-setting`,params)
  },
}

export default system
